package com.zyd.shiro.business.controller.pak;

import com.github.pagehelper.PageInfo;
import com.zyd.shiro.business.entity.OrderLine;
import com.zyd.shiro.business.service.PakOrderLineService;
import com.zyd.shiro.framework.object.BaseConditionVO;
import com.zyd.shiro.framework.object.PageResult;
import com.zyd.shiro.framework.object.ResponseVO;
import com.zyd.shiro.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.ApiOperation;


@RestController
@RequestMapping("/orderLine")
public class PakOrderLineController {
    @Autowired
    private PakOrderLineService orderLineService;

    @PostMapping
    @ApiOperation(value="添加", produces="application/json")
    public ResponseVO insert(OrderLine orderLine) {
        orderLineService.insert(orderLine);
        return ResultUtil.success("添加成功！",null);
    }

    @PutMapping
    @ApiOperation(value="修改", produces="application/json")
    public ResponseVO update(OrderLine orderLine) {
        orderLineService.updateSelective(orderLine);
        return ResultUtil.success("修改成功！",null);
    }

    @DeleteMapping(value = "/{id}")
    @ApiOperation(value="主键删除", produces="application/json")
    public ResponseVO delete(@PathVariable(name="id") Long id){
        orderLineService.removeByPrimaryKey(id);
        return ResultUtil.success("删除成功！",null);
    }

    @GetMapping
    @ApiOperation(value="分页查询", produces="application/json")
    public PageResult page(BaseConditionVO vo) {
        PageInfo<OrderLine> pageInfo = orderLineService.findPageBreakByCondition(vo);
        return ResultUtil.tablePage(pageInfo);
    }


}